// 工具函数，存储

export default {
    //增删改查
    setLocal(key, value) {
        localStorage.setItem(key, JSON.stringify(value)); //转为字符串存储
    },
    getLocal(key) {
        return JSON.parse(localStorage.getItem(key));
    },
    removeLocal(key) {
        localStorage.removeItem(key);
    },
    clearLocal() {
        sessionStorage.clear();
    },
    setSession(key, value) {
        sessionStorage.setItem(key, JSON.stringify(value));
    },
    getSession(key) {
        return JSON.parse(sessionStorage.getItem(key));
    },
    removeSession(key) {
        sessionStorage.removeItem(key);
    },
    clearSession() {
        sessionStorage.clear();
    },

}